tongfusoft.addDocTask = function() {
}
tongfusoft.addDocTask.prototype = {

	taskPlanTime : function() {

		$('#taskPlanTimeDiv').datetimepicker({
			format : 'YYYY-MM-DD HH:mm',

			icons : {
				time : 'fa fa-clock-o',
				date : 'fa fa-calendar',
				up : 'fa fa-chevron-up',
				down : 'fa fa-chevron-down',
				previous : 'fa fa-chevron-left',
				next : 'fa fa-chevron-right',
				today : 'fa fa-crosshairs',
				clear : 'fa fa-trash'
			}

		});

	},

	taskDetailCount : function() {
		var params = {};
		params["taskId"] = $("#taskId").val();
		common.post('task/taskDetailCount',params, function(data) {

			if (data.state == 'success') {
				$("#taskDetailCount").html('<a class="label label-info" href="'+	common.getContextPath("task/taskDetail/"+ $("#taskId").val()+"?page")+'">'+data.data+'</a>');
			}

		});

	},
	save : function() {
		var common = new tongfusoft.common();
		var params = {};
		params["taskId"] = $("#taskId").val();
		params["taskPlanTime"] = $("#taskPlanTime").val();
		params["taskTag"] = $("#taskTag").val();
		params["taskDetailNote"] = $("#taskDetailNote").val();
		params["taskExecutor"] = $("#taskExecutor").val();
		params["taskDetailName"] = $("#taskDetailName").val();
		common.post('task/addDocTask?save', params, function(data) {

			if (data.state == 'success') {
				var obj = new tongfusoft.addDocTask();
				obj.taskDetailCount();
				
				$("#taskPlanTime").val('');
				$("#taskTag").tagsinput('removeAll');
				
				$("#taskDetailNote").val('');
				$("#taskExecutor").val('');
				$("#taskPlanTime").val('');
				$("#taskDetailName").val('');
			}

		});

	}
	

}

$(function() {
	var obj = new tongfusoft.addDocTask();
	obj.taskPlanTime();
	obj.taskDetailCount();
	$("#btnSave").click(function() {
		obj.save();
	})
	
})